#include <gtest/gtest.h>
#include "Executor.hpp"
#include "PoseEq.hpp"
namespace adas
{
    //Fast
    //CarFast
    TEST(ExecutorFastTest, should_return_x_plus_4_given_status_is_fast_command_is_FM_and_facing_is_E)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}));
        //when
        executor->Execute("FM");
        const Pose target{4, 0, 'E'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    TEST(ExecutorFastTest, should_return_N_and_x_plus_1_and_y_plus_1_given_status_is_fast_command_is_FL_and_facing_is_E)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}));
        //when
        executor->Execute("FL");
        const Pose target{1, 1, 'N'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    TEST(ExecutorFastTest, should_return_S_and_x_plus_1_and_y_minus_1_given_status_is_fast_given_command_is_FR_and_facing_is_E)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}));
        //when
        executor->Execute("FR");
        const Pose target{1, -1, 'S'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    TEST(ExecutorFastTest, should_return_y_plus_2_given_command_is_FFM_and_facing_is_N)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor());
        //when
        executor->Execute("FFM");
        const Pose target{0, 2, 'N'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    //BusFast
    TEST(ExecutorFastTest, should_return_x_plus_2_given_status_is_fast_command_is_CFM_and_facing_is_E)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}));
        //when
        executor->Execute("CFM");
        const Pose target{2, 0, 'E'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    TEST(ExecutorFastTest, should_return_N_and_x_plus_2_given_status_is_fast_command_is_CFL_and_facing_is_E)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}));
        //when
        executor->Execute("CFL");
        const Pose target{2, 0, 'N'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    TEST(ExecutorFastTest, should_return_S_and_x_plus_2_given_status_is_fast_given_command_is_CFR_and_facing_is_E)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}));
        //when
        executor->Execute("CFR");
        const Pose target{2, 0, 'S'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
    TEST(ExecutorFastTest, should_return_y_plus_1_given_command_is_CFFM_and_facing_is_N)
    {
        //given
        std::unique_ptr<Executor> executor(Executor::NewExecutor());
        //when
        executor->Execute("CFFM");
        const Pose target{0, 1, 'N'};
        //then
        ASSERT_EQ(target, executor->Query());
    }
}